<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/resources/common/taglibs.jsp"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>课程学习 | 中国医学教育慕课联盟官方平台</title>
<meta http-equiv="X-UA-Compatible" content=" IE=EmulateIE9;IE=EmulateIE10;IE=EmulateIE11">
<link rel="shortcut icon" type="image/x-icon" href="${ctx}/resources/images/mooc.ico" />
<link rel="stylesheet" type="text/css" href="${ctx}/relfile/css/course.css">
<link rel="stylesheet" type="text/css" href="${ctx}/relfile/css/class.css">
<link rel="stylesheet" type="text/css" href="${ctx}/relfile/css/study_video.css">
<link rel="stylesheet" type="text/css" href="${ctx}/relfile/css/basic-sanqi.css">
<link rel="stylesheet" type="text/css" href="${ctx}/relfile/css/start-talk.css">
<link rel="stylesheet" type="text/css" href="${ctx}/relfile/css/talk_details.css">
<link rel="stylesheet" type="text/css" href="${ctx}/resources/js/jquery-easyui-1.4.3/themes/gray/easyui.css">
<link rel="stylesheet" type="text/css" href="${ctx}/resources/js/jquery-easyui-1.4.3/themes/icon.css">
<script type="text/javascript" src="${ctx}/resources/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/layer/layer.js"></script>
<script type="text/javascript" src="${ctx}/relfile/jq/jquery.form.js"></script>
<script type="text/javascript" src="${ctx}/relfile/jq/course.js"></script>
<script type="text/javascript" src="${ctx}/relfile/jq/json2.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctx}/resources/ueditor-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctx}/resources/ueditor-1.4.3/ueditor.all.js"> </script>
<script type="text/javascript" charset="utf-8" src="${ctx}/resources/ueditor-1.4.3/lang/zh-cn/zh-cn.js"></script>
<%-- <script src="${ctx}/relfile/jq/videosub-0.9.9.js"></script> --%>
<script src="${ctx}/relfile/jq/jwplayer.js"></script>
<script src="${ctx}/relfile/jq/common.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/relfile/jq/echarts.js"></script>
<script type="text/javascript" src="${ctx}/relfile/jq/validate.js"></script>
<script type="text/javascript">
	var courseid = '${courseid}';
	var userType = '${userType}';
	var user_id = '${user_id}';
	var isView = '${isView}';
	var progress='${progress}';
	var paperDialog;
    var paperGrid;
    var checkDialog;
	var editor;
	var userDataGridObj = null;
	var neweditor;
	var detailEditor;
	var topEditor;
	var pageNo = 1;
	var pageSize = 20;
	var allteacher = '${course.allteacher}';
	var goBackUrl;
	var dataPath = '<%=imgpath%>';
	var spocType = '${course.spoc_type}';
    var errorpagePath= '<%=errorpagePath%>';
    var paperPreview  ='<%=paperPreview%>';
    var platformType  ='<%=platformType%>';
    var paperAnswerUrl  ='<%=paperAnswerUrl %>';
    var paperExplainUrl  ='<%=paperExplainUrl %>';
	var myVideo;
	var hasAllteacher='${hasAllteacher}';
	var des_dlm = '${des_dlm}';
	var thePlayer;
	// 是否显示助教
	var is_assistant='${is_assistant}';
	$(function() {
		getInitSuccessBase();
	});

	function getInitSuccessBase() {
		$("#HomeWorkId").addClass('current');
		if(spocType==1){
			if(platformType==3){
				$("#sourceTxt").text("★  课程来源：联盟慕课");
			}else{
				$("#sourceTxt").text("★  课程来源：人卫慕课");
			}
		}else{
			$("#sourceTxt").text("★  课程来源：本校慕课");
		}
		getDiyPage();
		if(isView!=2){
			goBackUrl = "${ctx}/education/outline/"+courseid;
		}else{
			goBackUrl = "${ctx}/education/moocaddteacher/"+courseid;
		}
		if(userType==1||userType==3||userType==2){
			$("#returnList").show();
		}else{
			$("#returnList").hide();
		}
		if(progress==1){//从学生端个人中心的证书页链接过来请求
			goBackUrl = "${ctx}/study/credentials";
		}else if(progress==2){//公告预览
			goBackUrl = "${ctx}/education/moocaddcustom?courseid="+courseid+"&id="+'${noticeid}';
		}
		if(userType==4){
			isPermit();
		}
		//控制主观题评分是否显示
		if(is_assistant==1){
			$("#SubjectiveId").css("display","block");
		}else{
			$("#SubjectiveId").css("display","none");
		}
		
		//控制教师菜单是否显示		
		if(hasAllteacher==true||hasAllteacher=='true'){
			$("#AllTeacherId").css("display","block");
		}else{
			$("#AllTeacherId").css("display","none");
		}
		getHomeWorkList(courseid,-1);
	}
	
	function isPermit(){
		$.ajax({
			url : "${ctx}/study/isPermit/" + courseid,
			type : 'post',
			success : function(data) {
				if(!data.flag){
					location.href="${ctx}/study/go";
				}
			}
		});
	}
	
	function getDiyPage(){
		$.ajax({
			url : "${ctx}/study/gdp/" + courseid,
			type : 'post',
			success : function(data) {
				var str = "<ul>";
				$.each(data, function(i, item) {
					str+= "<li class='nav_title' style='background:url(../../../relfile/images/diy-icon1.png) no-repeat 70px center #fff;' id='diy_"+item.page_id+"' onclick='diyPageDetail("+JSON2.stringify(item)+")'>" + item.page_name +"</li>";
				});
				str+="</ul>";
				$("#diyPageArea").html(str);
			}
		});
	}
	
	function diyPageDetail(diyPage){
		$(".nav_title").removeClass('current');
        $(".time-base").removeClass('current');
        $("#diyPageDiv").addClass('current');
        $("#diy_" + diyPage.page_id).siblings().css("background","url(../../../relfile/images/diy-icon1.png) no-repeat 70px center #fff");
        $("#diy_" + diyPage.page_id).css("background","url(../../../relfile/images/diy-icon1c.png) no-repeat 70px center #1f8fcf");
        $("#diyTitle").html(diyPage.page_name);
        $("#diyContent").html(diyPage.content);
	}
	
	 /**
     * 判断内容是否为空
     */
    function isEmpty(obj){
	    if(typeof obj == undefined || obj == null || obj == ""){
	        return true;
	    }else{
	        return false;
	    }
	}
	
	/**
	 * 获取作业/考试列表
	 */
	var pageLoadingIndex = 0; // 页面加载第一次的表示
	function getHomeWorkList(courseid,type){
		var load = layer.msg("加载中，请稍后...", {icon: 16,shade: [0.1,'rgb(0, 0, 0)'],time:0,area: ["190px", "65px"]});
		$.ajax({
			url : "${ctx}/study/ghwl/" + courseid+"/" + type,
			type : 'post',
			dataType : 'json',
			success : function(data) {
				layer.close(load);
				if(data.homeCount>0){//存在作业答题记录，需要展示平均分
					$("#homeAvgId").css("display","block");
					$("#homeAvgId").html("<span>已答作业总平均分："+data.homeAvgScore+"</span>");
				}
				if(data.examCount>0){//存在试卷答题记录，需要展示平均分
					$("#examAvgId").css("display","block");
					$("#examAvgId").html("<span>已答试卷总平均分："+data.examAvgScore+"</span>");
				}
				var str = "";
				$.each(data.result, function(i, item) {//循环章节信息
					var content = item.content;
					if(content.length > 0){
						str+= "<div class='cer_num' style='float: left;'><h3 class='work_tit'>"+item.title+"</h3>";
						$.each(content,function(j,childitem){//循环内容信息
							var score = childitem.tiku.score;
							var type = childitem.type;
							var work_type = childitem.work_type;
							var calc_score = childitem.calc_score;
							if(isEmpty(type)){
								type = 0;
							}
							if(isEmpty(work_type)){
								work_type = 0;
							}
							if(isEmpty(calc_score)){
								calc_score = 0;
							}
							// str+="<div class='cer_W' style='margin-bottom: 6px;'><span>></span><span>"+childitem.title+"</span>";
							if(score==null||score<0||score==1000){
								score = 0;
								if(type == 4){ // 作业
									if(work_type == 0){ 
										if(calc_score == 0){ // 练习
											str += getExamOrHomewordHtml(childitem,"练习答题不计入总分","#FFDAB9","开始练习","");
										}else if(calc_score == 1){ // 作业
											str += getExamOrHomewordHtml(childitem,"","#E2F0D9","开始作业");
										}
									}else if(work_type == 1){ // 单元测试
										str += getExamOrHomewordHtml(childitem,"","#F4B183","开始测试");
									}
								}else if(type == 5){
									str += getExamOrHomewordHtml(childitem,"","#FF6347","进入考试","#FFFFFF");
								}
							}else{
								if(type == 4){ // 作业
									if(work_type == 0){ 
										if(calc_score == 0){ // 练习（不计分作业）
											str += getHomewordHtml(childitem,"练习答题不计入总分","#FFDAB9","解析/作答","");
										}else if(calc_score == 1){ // 作业（计分作业）
											str += getExamOrHomewordHtmlResult(childitem,"","#E2F0D9","查看解析");
										}
									}else if(work_type == 1){ // 单元测试
										str += getExamOrHomewordHtmlResult(childitem,"","#F4B183","查看解析");
									}
								}else if(type == 5){
									str += getExamOrHomewordHtmlResult(childitem,"","#FF6347","查看解析","#FFFFFF");
								}
								
							}
						});
						str+="</div>";
					}/* else {
						$("#contentStatus").css("display","none");
					} */
				});
				if(str==""){
					if(pageLoadingIndex == 0){
						$("#contentStatus").css("display","none");
					}else {
						$("#contentStatus").css("display","block");
					}
					str+= "<div style='text-align:center;font-size:16px;color:#c0c0c0;width: 900px;padding-top: 10px;'>暂无课程作业</div>";
				}else {
					$("#contentStatus").css("display","block");
				}
				pageLoadingIndex++;
				$("#homeWorkList").html("");
				$("#homeWorkList").html(str);
			}
		});
	}
	
	/**
	 * 根据条件获取不同的色块表示项目（练习、作业、单元测试，考试）
	 */
	function getExamOrHomewordHtml(childitem,calc_text,color,btnText,font_color){
		if(isEmpty(font_color)){
			font_color = "#000";
		}
		var str="<div class='cer_W' style='height: 36px;margin-bottom: 6px;color:"+font_color+";background: "+color+";'><span>></span><span>"+childitem.title+"</span>";
		str+="<span>截止时间："+ childitem.deadline +"<span style='float: right;color:red;'>"+calc_text+"</span></div>";
		str+="<button class='work_btn'";
		str+=	"onclick='intoPage("+JSON2.stringify(childitem)+","+childitem.contentid+",1,"+childitem.is_read+","+childitem.type+","+childitem.pager_type+")' style='cursor:pointer;'>"+btnText+"</button>";
		return str;
	}
	
	function getExamOrHomewordHtmlResult(childitem,calc_text,color,btnText,font_color){
		if(isEmpty(font_color)){
			font_color = "#000";
		}
		var str="<div class='cer_W' style='height: 36px;margin-bottom: 6px;color:"+font_color+";background: "+color+";'><span>></span><span>"+childitem.title+"</span>";
		str+="<span>截止时间："+ childitem.deadline +"<span style='float: right;color:red;'>"+calc_text+"</span></div>";
		str+="<button class='work_btn'";
		str+=	"onclick='intoPageDetail("+JSON2.stringify(childitem)+","+childitem.contentid+",1,"+childitem.is_read+","+childitem.type+","+childitem.pager_type+")' style='cursor:pointer;'>"+btnText+"</button>";
		return str;
	}
	
	function getHomewordHtml(childitem,calc_text,color,btnText,font_color){
		if(isEmpty(font_color)){
			font_color = "#000";
		}
		var str="<div class='cer_W' style='height: 36px;margin-bottom: 6px;color:"+font_color+";background: "+color+";'><span>></span><span>"+childitem.title+"</span>";
		str+="<span>截止时间："+ childitem.deadline +"<span style='float: right;color:red;'>"+calc_text+"</span></div>";
		str+="<button class='work_btn'";
		str+=	"onclick='goToPage("+JSON2.stringify(childitem)+","+childitem.contentid+",1,"+childitem.is_read+")' style='cursor:pointer;'>"+btnText+"</button>";
		return str;
	}
	
	//开始作业/考试答题
	function intoPage(data,id,showType,is_read,type,pager_type){
		if(id!=undefined){
			if(isView==1){//预览课件，把试卷上的答题按钮都隐藏
				if(showType==1){
					$("#showWorks").html("作业答题");
				}else{
					$("#showWorks").html("考试答题");
				}
				$('.time-base').removeClass('current');
				$("#infoPageArea").addClass('current');
				let infoPageTargetIframeUrl0 = paperPreview+"?paper_id="+id+"&PaperOrPackage="+pager_type+des_dlm;
				$("#infoPageTarget").attr("src", infoPageTargetIframeUrl0);
				window.open(infoPageTargetIframeUrl0, '_blank');
				getInitSuccessBase();
				$('.time-base').addClass('current');
				$("#infoPageArea").removeClass('current');
				$("#diyPageDiv").hide();
				// $("#infoPageTarget").attr("src",paperPreview+"?paper_id="+id+"&PaperOrPackage="+pager_type+des_dlm);
			}else{
				$.ajax({//验证答题截止日期是否有效
					url : "${ctx}/study/checkDeadLine/"+data.id+"/" + data.contentid,
					type : 'post',
					dataType:"json",
					success : function(datas) {
						if(datas.flag==true){
							if(showType==1){
								$("#showWorks").html("作业答题");
							}else{
								$("#showWorks").html("考试答题");
							}
							$('.time-base').removeClass('current');
							$("#infoPageArea").addClass('current');
							var domain = datas.domain;
						    if(domain){
								domain = "http://" + domain + "/";
							}
							if(pager_type!=undefined&&pager_type!=''&&pager_type!=null){
								let infoPageTargetIframeUrl1 = paperAnswerUrl+"?paper_id="+id+"&user_id="+user_id+"&des_deadline="+data.des_deadline+"&PaperOrPackage="+pager_type+"&domain="+domain+des_dlm;
								$("#infoPageTarget").attr("src",infoPageTargetIframeUrl1);
								window.open(infoPageTargetIframeUrl1, '_blank');
								getInitSuccessBase();
								// $("#infoPageTarget").attr("src",paperAnswerUrl+"?paper_id="+id+"&user_id="+user_id+"&des_deadline="+data.des_deadline+"&PaperOrPackage="+pager_type+"&domain="+domain+des_dlm);
							}else{
								let infoPageTargetIframeUrl2 =paperAnswerUrl+"?paper_id="+id+"&user_id="+user_id+"&des_deadline="+data.des_deadline+"&domain="+domain+des_dlm;
								$("#infoPageTarget").attr("src",infoPageTargetIframeUrl2);
								window.open(infoPageTargetIframeUrl2, '_blank');
								getInitSuccessBase();
								// $("#infoPageTarget").attr("src",paperAnswerUrl+"?paper_id="+id+"&user_id="+user_id+"&des_deadline="+data.des_deadline+"&domain="+domain+des_dlm);
							}
							$('.time-base').addClass('current');
							$("#infoPageArea").removeClass('current');
							$("#diyPageDiv").hide();
						}else{
							layer.alert("作业/试卷答题截止时间已过期，无法继续答题!",{icon: 2, title:'提示'});
						}
					}
				});
			}
		}else{
			layer.alert("试卷ID不存在",{icon: 0, title:'提示'});
			return;
		}
	}
	
	//查看解析
	function intoPageDetail(data,id,showType,is_read,type,pager_type){
		if(id!=undefined){
			if(showType==1){
				$("#showWorks").html("作业解析");
			}else{
				$("#showWorks").html("考试解析");
			}
			$('.time-base').removeClass('current');
			$("#infoPageArea").addClass('current');
			if(data.pager_type!=undefined&&data.pager_type!=''&&data.pager_type!=null){
				layer.confirm("当前试卷为试卷包且包含多份试卷，请选择以下操作继续！", {
					  btn: ["继续答题","查看解析"] //按钮
					}, function(index){
						layer.close(index);
						let infoPageTargetIframeUrl3 = paperAnswerUrl+"?paper_id="+id+"&user_id="+user_id+"&des_deadline="+data.des_deadline+"&PaperOrPackage="+data.pager_type+des_dlm;
						$("#infoPageTarget").attr("src",infoPageTargetIframeUrl3);
						window.open(infoPageTargetIframeUrl3, '_blank');
						getInitSuccessBase();
						$('.time-base').addClass('current');
						$("#infoPageArea").removeClass('current');
						$("#diyPageDiv").hide();
						// $("#infoPageTarget").attr("src",paperAnswerUrl+"?paper_id="+id+"&user_id="+user_id+"&des_deadline="+data.des_deadline+"&PaperOrPackage="+data.pager_type+des_dlm);
					}, function(index){
						layer.close(index);
						let infoPageTargetIframeUrl4 = paperExplainUrl+"?paper_id="+id+"&user_id="+user_id+"&PaperOrPackage="+data.pager_type+des_dlm;
				  		$("#infoPageTarget").attr("src", infoPageTargetIframeUrl4);
						window.open(infoPageTargetIframeUrl4, '_blank');
						getInitSuccessBase();
						$('.time-base').addClass('current');
						$("#infoPageArea").removeClass('current');
						$("#diyPageDiv").hide();
				  		// $("#infoPageTarget").attr("src",paperExplainUrl+"?paper_id="+id+"&user_id="+user_id+"&PaperOrPackage="+data.pager_type+des_dlm);
				});
			}else{
				let infoPageTargetIframeUrl5 = paperExplainUrl+"?paper_id="+id+"&user_id="+user_id+des_dlm;
				$("#infoPageTarget").attr("src",infoPageTargetIframeUrl5);
				window.open(infoPageTargetIframeUrl5, '_blank');
				getInitSuccessBase();
				$('.time-base').addClass('current');
				$("#infoPageArea").removeClass('current');
				$("#diyPageDiv").hide();
				// $("#infoPageTarget").attr("src",paperExplainUrl+"?paper_id="+id+"&user_id="+user_id+des_dlm);
			}
		}else{
			layer.alert("试卷ID不存在",{icon: 0, title:'提示'});
			return;
		}
	}
	
	//初始化试卷包中试卷列表弹出框
	function initPaperDialog(type,packageId,data,showType,is_read){
		paperDialog = $('#paperDialog').dialog({    
		    title: "选择内容",
		    width: 700,
		    height: 400,    
		    closed: false,    
		    cache: false,    
		    modal: true,
		    buttons:[{
				text:'预览',
				handler:function(){
					var rows = $("#paperGrid").datagrid('getSelections');
					if (rows.length != 1) {
						layer.alert("请选择一条记录!",{icon: 0, title:'提示'});
						return;
					}else{
						var paperid=rows[0].ID;
						f_showPageDetail(data,paperid,showType,is_read);
						//f_viewContent(type,paperid);
						$('#paperDialog').dialog('close');
					}
				}
			},{
				text:'关闭',
				handler:function(){
					$('#paperDialog').dialog('close');
				}
			}]
		});
		initPaperGrid(type,packageId);
		$('#paperDialog').dialog('open');
	}
	
	function f_showPageDetail(data,id,showType,is_read){
		if(id!=undefined){
			if(showType==1){
				$("#showWorks").html("作业解析");
			}else{
				$("#showWorks").html("考试解析");
			}
			$('.time-base').removeClass('current');
			$("#infoPageArea").addClass('current');
			let infoPageTargetIframeUrl6 = paperExplainUrl+"?paper_id="+id+"&user_id="+user_id+des_dlm;
			$("#infoPageTarget").attr("src", infoPageTargetIframeUrl6);
			window.open(infoPageTargetIframeUrl6, '_blank');
			getInitSuccessBase();
			$('.time-base').addClass('current');
			$("#infoPageArea").removeClass('current');
			$("#diyPageDiv").hide();
			// $("#infoPageTarget").attr("src",paperExplainUrl+"?paper_id="+id+"&user_id="+user_id+des_dlm);
		}else{
			layer.alert("试卷ID不存在",{icon: 0, title:'提示'});
			return;
		}
	}
	
	function initPaperGrid(type,packageId,paperName){
		var paperName=$("#paperName").val();
		if(paperName=='试卷名称'||paperName==''||paperName==undefined){
			paperName="";
		}
		paperGrid = $('#paperGrid').datagrid({
            nowrap : false,//设置为true，当数据长度超出列宽时将会自动截取
            striped : true,//设置为true将交替显示行背景。
            collapsible : false,//显示可折叠按钮
            url:"${ctx}/study/gtpl/"+courseid+"/"+type+"/1",//url调用Action方法
            queryParams:{'papername':paperName,'packageId':packageId},
            columns:[[
		        {field:'ID',title:'ID',width:50},    
		        {field:'NAME',title:'试卷名称',width:200},
		        {field:'ADDTIME',title:'创建时间',width:100,align:'center'},
		        {field:'VALIDITYDATE',title:'有效日期',width:100,align:'center'},
		        {field:'DESCRIPTION',title:'描述',width:180}
		    ]],
            loadMsg : '数据装载中......',
            singleSelect:true,//为true时只能选择单行
            fitColumns:false,//允许表格自动缩放，以适应父容器
            idField:'id',
            remoteSort : false,
            checkOnSelect:true,
            pagination : true,//分页
			rownumbers : true,//行数
			pageSize : 10,//每页显示的记录条数，默认为15?
			pageList : [ 10, 15, 20, 30 ],//可以设置每页记录条数的列表
			onLoadSuccess : function(row) {
				$(this).datagrid('clearSelections');
			}
		});
	}
	
	//条件检索
	function f_selectPaper(){
		var paperName=$("#paperName").val();
		var type=$("#paperSeachType").val();
		var packageId=$("#pagerOrPackage").val();
		initPaperGrid(type,packageId,paperName);
	}
	
	function goHome(){
		window.location = goBackUrl;
	}
	
	var studentDialog;
	var lay_data;
	var lay_id;
	var lay_showType;
	function goToPage(data,id,showType,is_read){
		lay_data=data;
		lay_id=id;
		lay_showType=showType;
		layer_Dialog("选择操作","goToPageDlg",false,1,"450","300");
	}
	
	function checkToPage(){
		var checkedVal=$(":radio:checked").val();//单选按钮选中值
		if(checkedVal==0){//查看解析
			if(lay_showType==1){
				$("#showWorks").html("作业解析");
			}else{
				$("#showWorks").html("考试解析");
			}
			$('.time-base').removeClass('current');
			$("#infoPageArea").addClass('current');
			let infoPageTargetIframeUrl7 = paperExplainUrl+"?paper_id="+lay_id+"&user_id="+user_id+des_dlm;
			$("#infoPageTarget").attr("src",infoPageTargetIframeUrl7);
			window.open(infoPageTargetIframeUrl7, '_blank');
			getInitSuccessBase();
			$('.time-base').addClass('current');
			$("#infoPageArea").removeClass('current');
			$("#diyPageDiv").hide();
			// $("#infoPageTarget").attr("src",paperExplainUrl+"?paper_id="+lay_id+"&user_id="+user_id+des_dlm);
			layer.closeAll();
		}else if(checkedVal==1){//继续作答
			$.ajax({
				url : "${ctx}/study/checkDeadLine/"+lay_data.id+"/" + lay_data.contentid,
				type : 'post',
				dataType:"json",
				success : function(datas) {
					layer.closeAll();
					if(datas.flag==true){
						if(lay_showType==1){
							$("#showWorks").html("作业答题");
						}else{
							$("#showWorks").html("考试答题");
						}
						var domain = datas.domain;
						if(domain){
						    domain = "http://" + domain + "/";
						}
						$('.time-base').removeClass('current');
						$("#infoPageArea").addClass('current');
						let infoPageTargetIframeUrl8 = paperAnswerUrl+"?paper_id="+lay_id+"&user_id="+user_id+"&des_deadline="+lay_data.des_deadline+"&domain="+domain+des_dlm;
						$("#infoPageTarget").attr("src",infoPageTargetIframeUrl8);
						window.open(infoPageTargetIframeUrl8, '_blank');
						getInitSuccessBase();
						$('.time-base').addClass('current');
						$("#infoPageArea").removeClass('current');
						$("#diyPageDiv").hide();
						// $("#infoPageTarget").attr("src",paperAnswerUrl+"?paper_id="+lay_id+"&user_id="+user_id+"&des_deadline="+lay_data.des_deadline+"&domain="+domain+des_dlm);
					}else{
						layer.alert("作业/试卷答题截止时间已过期，无法继续答题!",{icon: 2, title:'提示'});
					}
				}
			});
		}
	}
	
	//保存dialog信息公用方法 
    function layer_SaveData(L_type){
	  	if(L_type==1){
	  		checkToPage();
	  	}
    }
	
    function getCourseware(accessType){
		window.location="${ctx}/study/crdl/"+courseid+"/"+isView+"?accessType="+accessType;
	}
    
    /**
     * 切换标题
     */
    function onChangeShowContent(mark){
    	if(mark == 1){
    		$("#examOrHomewordShow").show();
    		$("#explainShow").hide();
    		$("#examOrHomeworkTitle").addClass('pageTitle_checked');
    		$("#explainTitle").removeClass('pageTitle_checked');
    		/* document.getElementById('kczt').value="-1";
    		$("#homeWorkList").html("");
    		getHomeWorkList(courseid,-1); */
    	}else if(mark == 2){
    		$("#examOrHomewordShow").hide();
    		$("#explainShow").show();
    		$("#examOrHomeworkTitle").removeClass('pageTitle_checked');
    		$("#explainTitle").addClass('pageTitle_checked');
    	}
    }
    
    var content_status;
    function onChangeContentStatus(){
    	content_status = document.getElementById("kczt").value;
    	getHomeWorkList(courseid,content_status);
    }
	
</script>
</head>
<style>
.page{background:rgba(0,0,0,0.8);margin:0px;position:relative; z-index:9999; width:100%; height:100%; position:fixed; display:none;}
.reset{height:380px; width:820px; border:7px solid #efefef; padding:30px 40px; font-size:15px; position:absolute; left:50%; top:70px; margin-left:-420px; background:#fff; position:relative; }
.currenttopage{height:50px;color:#fff; margin-top:-4px; line-height:50px;}
.hs{float:right;margin:30px 30px 0px 30px !important;font-size: 14px !important;padding:0px !important;}
.vadio_box{clear:both;}
.talk_box{clear:both;}
#mediaplayer_wrapper{padding-left: 40px;}
</style>
<body>
<%-- 	<c:choose>
		<c:when test="${sessionScope.agency.type==4}">
			<jsp:include page="graduate-headersp.jsp"/>
		</c:when>
		<c:otherwise>
			<jsp:include page="headersp.jsp"/>
		</c:otherwise>
	</c:choose> --%>
	
	<c:set var="platformType" value="<%=platformType%>"></c:set>
	<c:choose>
		<c:when test="${platformType==3}">
			<jsp:include page="graduate-headersp.jsp"/>
		</c:when>
		<c:otherwise>
			<c:choose>
				<c:when test="${sessionScope.agency.type==4}">
					<jsp:include page="graduate-headersp.jsp"/>
				</c:when>
				<c:otherwise>
					<jsp:include page="headersp.jsp"/>
				</c:otherwise>
			</c:choose>
		</c:otherwise>
	</c:choose>
	
	<div class="contect">
		<div class="con-page" style="position:relative;">
		<button id="returnList" onclick="goHome();" style="height:30px; width:90px; background:#f56d01; position:absolute; right:1px; top:5px; color:#fff;cursor:pointer;display: none;">返回</button>
			<div class="main-cir-L">
				<jsp:include page="coursedetail_left.jsp"/>
				<div class="main_base">
					<!-- 作业区 -->
					<div class="time-base current clear" style="height: auto;">
						<button style="display:none;background:#FF0000;float:right;font-size:16px;color:#fff;width: 110px;text-align:center;cursor: pointer;"
								id="homeworkPayId" onclick="f_payForStudy('${course.id}')">付费学习</button>
						<h2 class="fila_tit">
							<span class="pageTitle pageTitle_checked" id="examOrHomeworkTitle" onclick="onChangeShowContent(1)">客观题</span>
							<span class="pageTitle" id="explainTitle" onclick="onChangeShowContent(2)">说明</span>
						</h2>
						
						<div id="examOrHomewordShow">
							<div>
								<div style="float: left;padding-left: 20px;">
									<h2 class="exam_avg_score" id="homeAvgId"><span></span></h2>
								</div>
								<div style="float: left;padding-left: 60px;">
									<h2 class="exam_avg_score" id="examAvgId"><span></span></h2>
								</div>
								<div class="R-input" style="display:none;padding-left: 0px;" id="contentStatus" >
									<label>客观题类型：</label> 
									<select id="kczt" onchange="onChangeContentStatus();" style="height: 30px;width: 90px;border: 1px solid #ccc;">
										<option value="-1">全部</option>
										<option value="1">练习</option>
										<option value="2">作业</option>
										<option value="3">单元测试</option>
										<option value="4">考试</option>
									</select> <span></span>
								</div>
							</div>
							
							<div id="homeWorkList"><!-- style="float: left;" -->
								
							</div>
						</div>
						
						<div id="explainShow" class="tab_show_div">
							<table class="tab_eval">
								<tr>
									<th> </th>
									<td class="lx">练习</td>
									<td class="zy">作业</td>
									<td class="zy">单元测试</td>
									<td class="lx">考试</td>
								</tr>
								<tr class="tab_tr">
									<th>总分计算</th>
									<td>不计入总成绩</td>
									<td>计入总成绩</td>
									<td>计入总成绩</td>
									<td>计入总成绩</td>
								</tr>
								<tr class="tab_tr">
									<th>时间限制</th>
									<td>不计时</td>
									<td>不计时</td>
									<td>不计时</td>
									<td>计时</td>
								</tr>
								<tr class="tab_tr">
									<th>习题来源</th>
									<td>本节知识点</td>
									<td>本节知识点</td>
									<td>全章知识点</td>
									<td>课程所有知识点</td>
								</tr>
								<tr class="tab_tr">
									<th>评分规则</td>
									<td>不计入课程总成绩</td>
									<td>按照“客观题-作业”权重记分</td>
									<td>按照“客观题-作业”权重记分</td>
									<td>按照“客观题-考试”权重记分</td>
								</tr>
							</table>
						</div>
						
					</div>
					
					<!-- 自定义页面区 -->
					<div class="time-base" id="diyPageDiv">
						<h2 class="fila_tit"><span class="flia_li" id="diyTitle"></span></h2>
							<div class="con_Center con_change" style="margin-top:30px" id="diyContent">
							</div>
					</div>
				 
					<div class="time-base" id="infoPageArea">
						<h2 class="fila_tit"><span class="flia_li" id="showWorks"></span></h2>
						<!-- <iframe id="infoPageTarget" frameborder="0" scrolling='auto'  style="width:100%;height:800px;overflow:hidden;margin:0;"></iframe> -->
						<span id="infoPageTarget" style="visibility: hidden;"></span>
	                </div>
			</div>
		</div>
	</div>
	</div>
	<div class="page">
		<input type="hidden" id="top_type">
        <div class="reset">
            <div class="re_con">
           		<textarea id="topTalkArea" style="width: 100%;"></textarea>
           		<button style="background:#1f8fcf;color:#fff;font-size:15px;width:140px;height:36px;float:left;margin:10px 20px 0px 205px;cursor:pointer;" onclick="saveTopTalk();">保存</button>
           		<button style="background:#1f8fcf;color:#fff;font-size:15px;width:140px;height:36px;float:left;margin:10px 20px 0px 30px;cursor:pointer;" onclick="closeSingleTalk();">取消</button>
            </div>
        </div>
	</div>
	
	<!-- 选择继续答题或者  -->
	<div id="goToPageDlg" style="display:none;">
		<div style="margin:50px 0px 0px 30px;font-size:14px;">
			请选择操作类型:
			<input type="radio" name="operateType" value="0" style="margin-left:20px;" checked="checked" />查看解析
			<input type="radio" name="operateType" value="1" style="margin-left:40px;"/>继续答题
	   </div> 
	</div>
	
	<!-- 试卷包查看试卷列表 -->
	<div id="paperDialog" style="width:760px;height:390px;">
	 	<table id="paperGrid" toolbar="#paperTb"></table>
	</div>
	<div id="paperTb" style="padding:3px;display:none;">
		<span style="font-size:12px;">检索条件:</span>
		<input name="paperSeachType" id="paperSeachType" type="hidden"/>
		<input id="paperName" placeholder="试卷名称" style="line-height:26px;border:1px solid #ccc;width:200px;">
		<a href="javascript:void(0);" class="easyui-linkbutton" plain="true" onclick="f_selectPaper();">搜索</a>
	</div> 
<jsp:include page="footer.jsp" />
<style type="text/css">
	.color1{
		color:#c0c0c0;
		cursor:inherit;
	}
	.color2{
		color:#2883BC;
		cursor:pointer;
	}
	
	/* 2018年4月2日 17:23:53 */
	
	.exam_avg_score{
		/* padding-left:694px;
		margin-bottom:-10px; */
		color:red;
		font-size: 16px;
		display:none;
	}
	
	.pageTitle{
		padding: 8px 40px;
	}
	
	.pageTitle_checked{
		border-bottom: 3px solid #e46600;
	}
	
	.tab_show_div{
		display: none;
		padding: 20px 0px 0px 20px;
	}
	
	.tab_css{
		width: 85%;
	}
	
	.tab_css tr:first-child{
		text-align: center;
	}
	
	.tab_css tr{
		height: 45px;
		text-align: center;
	}
	
	.tab_tr td{
		padding: 0px 0px 0px 10px;
	}
	
	.tab_css tr td{
		border: 2px solid #5f5146;
	}
	
	.tab_eval {
		width: 98%;
		font-family: "Trebuchet MS", sans-serif;
	    font-size: 16px;
	    font-weight: bold;
	    line-height: 1.4em;
	    font-style: normal;
	    border-collapse: separate;
	}
	
	.tab_eval tr td{
		padding: 10px;
	    text-align: center;
	    background-color: #444;
	    /* background: -webkit-gradient( linear, left bottom, left top, color-stop(0.39, rgba(189, 189, 189, 0.65)), color-stop(0.7, rgba(224, 224, 224, 0.83)) ); */
	    background:url("${ctx}/relfile/images/zgt/button_new.png") left top repeat-x;
	    border: 2px solid #ffffff;
	    -moz-border-radius: 2px;
	    -webkit-border-radius: 2px;
	    border-radius: 2px;
	    color: #333;
	}
	
	.tab_eval tr:first-child td{
		padding: 10px;
	    text-align: center;
	    background-color: #1f8fcf;
	    border: 1px solid #E7EFE0;
	    -moz-border-radius: 2px;
	    -webkit-border-radius: 2px;
	    border-radius: 2px;
	    font-weight: 600;
	    color: #fff;
	    /* background: -webkit-gradient( linear, left bottom, left top, color-stop(0.39, #0092dca3), color-stop(0.7, #0092dcc7) );
	    background: -moz-linear-gradient( left bottom, rgb(158,217,41) 2%, rgb(139,198,66) 51%, rgb(123,192,67) 87% ); */
	    background: #1f8fcf;
	    -moz-border-radius: 5px 0px 0px 5px;
	    -webkit-border-top-left-radius: 5px;
	    -webkit-border-bottom-left-radius: 5px;
	    border-top-left-radius: 5px;
	    border-bottom-left-radius: 5px;
	}
	
	.tab_tr .lx{
	    background: -webkit-gradient( linear, left bottom, left top, color-stop(0.39, #9fd8f5a3), color-stop(0.7, #9fd8f5a3) );
	}
	.tab_tr .zy{
	    background: -webkit-gradient( linear, left bottom, left top, color-stop(0.39, #2db9ffa3), color-stop(0.7, #2db9ffa3) );
	}
	.tab_tr .ks{
	    background: -webkit-gradient( linear, left bottom, left top, color-stop(0.39, #099ee8a3), color-stop(0.7, #099ee8a3) );
	}
	
	.tab_eval tr th {
		text-align: center;
    	color: #fff;
    	border-radius: 8px;
		font-weight:600;
	    background-color: #1f8fcf;
	    border: 1px solid #ffffff;
	    border-right: 3px solid #ffffff;
	    padding: 0px 10px;
	    background: -webkit-gradient( linear, left bottom, right top, color-stop(0.02, #2695d4eb), color-stop(0.51, #2c89b8e0), color-stop(0.87, #2883bc) );
	    background: -moz-linear-gradient( left bottom, rgb(158,217,41) 2%, rgb(139,198,66) 51%, rgb(123,192,67) 87% );
	}
	.tab_eval th {width: 90px;}
	
</style>
</body>
</html>